#!/bin/bash
>up.txt
>down.txt
for i in {1..254}
do
	(ping -c 1 -i 0.02 -w 1 192.168.0.${i} &>/dev/null
	if (($?==0))
	then
		echo 192.168.0.${i} >>up.txt
	else
		echo 192.168.0.${i} >>down.txt
	fi)&
done
sleep 1.1
a=`cat up.txt|wc -l`
b=`cat down.txt|wc -l`
cat up.txt|sort -t "." -k 4 -n
echo -e "\e[31musing of the ip are $a\e[0m"
cat down.txt|sort -t "." -k 4 -n
echo -e "\e[33mnot use of the ip are $b\e[0m"
